<!DOCTYPE html>
<html lang="en">
<head>
      <meta charset="UTF-8">
      <title> {{ title }} </title>
      <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
      
</head>

<body>
    
<!--    <h1>选择上传文件</h1>
    <form action="http://127.0.0.1:8080/upload" method="POST" enctype="multipart/form-data">
        <p>
            <input type="file" name="file">
        </p>
        <p>
            <input type="submit" value="上传">
        </p>
    </form>-->
    
    <fieldset>
    <legend>文件信息</legend>
    <table class="table" style="width: 100%;">
        <tr>
            <th style="width: 20%;">
                文件:
            </th>
            <td>
                <input id="file" name="file" type="file" style="width:300px;height: 25px">
            </td>
        </tr>
        <tr>
            <th>重命名</th>
            <td>
                <input id="newFileName"  style="width:300px;height: 20px"/>
            </td>
        </tr>
        <tr>
            <th>分类:</th>
            <td>
                <input id="fileType"  style="width:300px;height: 25px">
            </td>
        </tr>
    </table>
</fieldset>
    
<script>
function uploadFile() {

            var myform = new FormData();

            myform.append('file', $("#file")[0].files[0]);

            myform.append('fileType',$("#fileType").val());

            myform.append('keywords',$("#keywords").val());

            $.ajax({

                url: sy.managerServerUrl + "file/uploadFileByFrom",//"http://192.168.5.206:8983/solr/update/extract",

                type: "POST",

                data: myform,

                async: false,

                contentType: false,

                processData: false,

                success: function (result) {

                    if (result && result.result) {

                        getFileListPage();

                    } else {

                        $.messager.alert("警告", "文件上传失败！", "warning", function () {

                            var file = document.getElementById('file');

                            file.value = '';

                        });

                    }

                },

                error: function (data) {

                    $.messager.alert("警告", "文件上传失败！", "warning", function () {

                        var file = document.getElementById('file');

                        file.value = '';

                    });

                }

            });

        }


</script>

</body>

</html>